package com.randi.common.core.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.randi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Transient;

import java.io.Serializable;
import java.util.Date;

/**
 * @author ziye
 */
@Data
@ApiModel(value = "Entity对象", description = "Entity基类")
public class BaseEntity implements Serializable {

    @TableField(value = "`status`")
    @ApiModelProperty(value = "状态")
    private Integer status;

    @TableField(exist = false)
    @ApiModelProperty(value = "状态名称")
    private String statusName;

    @TableField(value = "`deleted`")
    @ApiModelProperty(value = "删除标志", hidden = true)
    private Integer deleted;

    @ApiModelProperty(value = "创建者", hidden = true)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;

    @ApiParam(hidden = true)
    @ApiModelProperty(value = "创建时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "更新者", hidden = true)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;

    @ApiModelProperty(value = "更新时间", hidden = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "更新时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @ApiModelProperty(value = "备注", hidden = true)
    private String remark;

    @Transient
    @ApiModelProperty(value = "创建者名称", hidden = true)
    private String createName;

    @Transient
    @ApiModelProperty(value = "更新者名称", hidden = true)
    private String updateName;

}
